04. Examples of calculating the mean and the standard deviation

PRDTM2-787 AI Trading C4 L1 Vid4 Examples Of Calculating The Mean And The Standard Deviation

Understanding Mean and Standard Deviation with Dividends

Learn to calculate the mean and standard deviation through a practical example using dividend payments:

Exercise with Quarterly Dividends

  • Company "ABC": Paid $1 per share for 3 years (12 payments).
  • Mean: With all values at $1, the mean is $1.
  • Variance & Standard Deviation: Zero, as there's no variation in payments.

Change in Dividend Payment

  • New Payment: Last dividend increased to $1.20.
  • Updated Mean: Total dividends = $13.20 / 13 payments = $1.015.
  • Variance Calculation:
    • Subtract mean: -0.015 for 12 payments, 0.185 for the last.
    • Square differences, sum to get 0.037, divide by 13 = variance of 0.003.
  • Standard Deviation: Square root of variance = 0.053.

Using Python for Calculations

  • Python Package: NumPy simplifies numerical tasks.
    • np.mean() for mean.
    • np.var() for variance.
    • np.std() for standard deviation.
  • Practice With Code: Recalculate using NumPy for precision.

Using these steps and tools, effectively grasp statistical calculations and empower data analysis through coding.

What is the standard deviation of the following series of numbers?

array([-0.22824345, 0.79223357, -0.30496221, 1.86392714, -0.65377085,
0.29952795, 0.60764897, -1.6163826 , 1.09615426, -1.1978447 ])

SOLUTION: 1.017

Correct Answer

QUESTION:

What is the mean and the standard deviation of A = [0, 2, 4, 6, 8]?

ANSWER:

The mean is (0 + 2 + 4 + 6 + 8)/5 = 4. The variance is (0 - 4)2 + (2 - 4)2 + (4 - 4)2 + (6 - 4)2 + (8 - 4)**2 = 8. So the standard deviation is sqrt(8) = 2.83.